package com.wkbb.basic.service.impl;

import com.wkbb.basic.mapper.EmployeeMapper;
import com.wkbb.basic.mapper.StudentMapper;
import com.wkbb.basic.model.Employee;
import com.wkbb.basic.service.EducationStatService;
import com.wkbb.common.base.BaseService;
import com.wkbb.common.base.BaseServiceImpl;
import com.wkbb.common.enums.RoleTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author luowenyan
 * @version V1.0
 * @className EducationStatServiceImpl
 * @description TODO
 * @date 2019/10/23 10:16
 */
@Service
@Slf4j
public class EducationStatServiceImpl implements EducationStatService {

    @Autowired
    private StudentMapper studentMapper;

    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public Integer getCountByRoleType(Long orgId, RoleTypeEnum roleTypeEnum) {
        Integer count = 0;
        if(roleTypeEnum == RoleTypeEnum.STUDENT){
            count = studentMapper.getCountByOrgId(orgId);
        }else if(roleTypeEnum == RoleTypeEnum.TEACHER){
            count = employeeMapper.getCountByOrgId(orgId);
        }
        return count;
    }
}
